using ASP;
using HoWave.Common;
using HoWave.Data;
using HoWave.Data.Bll;
using HoWave.Data.Model;
using HoWave.Web;
using HoWave.Web.Shop;
using System;
using System.Collections;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class Web_ShopBuy : Shop, IRequiresSessionState
{
	protected static int m_ProductID = 0;
	protected int m_SalerID;
	protected int m_BuyUserID;
	protected decimal m_Price;
	protected int TeamBeforeCycleNum = 0;
	protected int TeamAfterCycleNum = 0;
	protected int TotalBeforeNumber = 0;
	protected int TotalAfterNumber = 0;
	protected string m_deliverPayType = "";
	protected DataRow row;
	private HoWaveProduct _product = null;
	private string showProType = "";
	private int _Delive_Type_ID = 0;
	private Shop_DeliverType _shop_deliver = null;
	private Shop_City _city;
	protected UserControls_cmpy_Top Top1;
	protected ScriptManager ScriptManager1;
	protected HyperLink ProductName;
	protected Literal ProductPrice;
	protected Image ProductImage;
	protected HiddenField HiddenField1;
	protected DropDownList otherChoice;
	protected Repeater repotherBus;
	protected PlaceHolder TeamBuyPanel;
	protected TextBox AuctionEndPrice;
	protected Literal AuctionCurrentPrice;
	protected RequiredFieldValidator RequiredFieldValidator6;
	protected Literal AuctionCurrentPrice2;
	protected PlaceHolder ShowAuction;
	protected TextBox TxtStardPrice;
	protected PlaceHolder ShowPrice;
	protected TextBox TextBox_Promote;
	protected PlaceHolder ShowPromote;
	protected Label lblNeedPresentExp;
	protected PlaceHolder ShowNeedPresentExp;
	protected TextBox Amount;
	protected Label CanBuy;
	protected Repeater PayType;
	protected HiddenField hfSelectPayType;
	protected Literal DroDeliverPayType;
	protected HiddenField hfdeliverPayType;
	protected RadioButtonList rblDeliverFashion;
	protected RadioButtonList deliverType;
	protected UpdatePanel upDeliverFashion;
	protected HtmlGenericControl confirDeliver;
	protected ImageButton imgbtnNewAddAddress;
	protected UpdatePanel upAddNewAddresss;
	protected RadioButtonList my_receive_address;
	protected UpdatePanel upAddress;
	protected HtmlGenericControl manage_address_tr;
	protected TextBox ContacterName;
	protected RequiredFieldValidator RequiredFieldValidator2;
	protected TextBox mobilePhone;
	protected RegularExpressionValidator RegularExpressionValidator3;
	protected TextBox homePhone;
	protected RegularExpressionValidator RegularExpressionValidator4;
	protected DropDownList ddlProvince;
	protected DropDownList ddlCity;
	protected DropDownList ddlArea;
	protected UpdatePanel upProvinceCityArea;
	protected TextBox Address;
	protected RequiredFieldValidator RequiredFieldValidator4;
	protected TextBox Email;
	protected RequiredFieldValidator rfvEmail;
	protected RegularExpressionValidator revEmail;
	protected TextBox zipCode;
	protected RequiredFieldValidator RequiredFieldValidator1;
	protected RegularExpressionValidator RegularExpressionValidator1;
	protected Button CmdNewAddress;
	protected HtmlGenericControl show_new_address;
	protected UpdatePanel upAddressDiv;
	protected TextBox txtInvoiceHead;
	protected TextBox txtInvoiceName;
	protected TextBox txtInvoiceMonery;
	protected CheckBox Invoice_Need;
	protected RadioButtonList RadioButtonList_InvoiceType;
	protected PlaceHolder Product_Need_Invoice;
	protected DropDownList ddlCoupon;
	protected Panel Product_Need_Coupon;
	protected TextBox Remark;
	protected HiddenField hfTotalMoney;
	protected TextBox TradeProtocal;
	protected Label err_tips;
	protected ImageButton ImageButton1;
	protected HiddenField HiddenField2;
	protected UserControls_CMYP_Foot Foot1;
	protected HtmlForm aspnetForm;
	protected HtmlGenericControl Html1;
	protected HoWaveProduct m_product
	{
		get
		{
			HoWaveProduct product;
			if (this._product == null)
			{
				this._product = new HoWaveProduct(this.conn);
				product = this._product;
			}
			else
			{
				product = this._product;
			}
			return product;
		}
	}
	public new string ShowProType
	{
		get
		{
			return this.showProType;
		}
		set
		{
			this.showProType = value;
		}
	}
	public int Delive_Type_ID
	{
		get
		{
			return this._Delive_Type_ID;
		}
		set
		{
			this._Delive_Type_ID = value;
		}
	}
	public Shop_DeliverType shop_deliver
	{
		get
		{
			if (this._shop_deliver == null)
			{
				this._shop_deliver = new Shop_DeliverType(this.conn);
			}
			return this._shop_deliver;
		}
	}
	protected Shop_City m_city
	{
		get
		{
			if (this._city == null)
			{
				this._city = new Shop_City();
			}
			return this._city;
		}
	}
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_PreInit(object sender, EventArgs e)
	{
		try
		{
		}
		catch (Exception ex)
		{
			base.WriteTemErrMsg(ex.Message.ToString());
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.user.CheckUserLogin())
		{
			this.WriteErrMsg("", Language.GetMemberMsg("Common/NotLogin", new string[0]), this.InstallDir + "Passport/Login.aspx?ComeUrl=" + base.Server.UrlEncode(Fetch.CurrentUrl));
		}
		this.hideAddress();
		this.m_BuyUserID = base.user.UserID;
		Web_ShopBuy.m_ProductID = Fetch.GetID("ProductID");
		Shop_Product shop_Product = new Shop_Product(this.conn);
		if (shop_Product.Justcarriage(Web_ShopBuy.m_ProductID) == 1)
		{
			this.WriteErrMsg2("", Language.Get("Shop/Product/EnableSale"), "ShowProduct.aspx?ProductID=" + Web_ShopBuy.m_ProductID);
		}
		else
		{
			if (shop_Product.Justcarriage(Web_ShopBuy.m_ProductID) == 2)
			{
				this.WriteErrMsg2("", Language.Get("Shop/Product/NotTime"), "ShowProduct.aspx?ProductID=" + Web_ShopBuy.m_ProductID);
			}
			else
			{
				if (!base.IsPostBack)
				{
					this.Bind();
					this.BindPage();
					this.BindAddress();
					this.ContacterName.Attributes.Add("OnBlur", "isChinese()");
					this.Product_Need_Coupon.Style["display"] = "none";
					if (this.ShowProType != "5")
					{
						if (base.OwnerPromotionPower(this.m_SalerID))
						{
							decimal d = 0m;
							decimal d2 = 0m;
							decimal d3 = 0m;
							int num = Convert.ToInt32(this.Amount.Text);
							string value = this.hfdeliverPayType.Value;
							if (value != null)
							{
								if (value == "0")
								{
									goto IL_2FA;
								}
							}
							string text = "";
							for (int i = 0; i < this.deliverType.Items.Count; i++)
							{
								if (this.deliverType.Items[i].Selected)
								{
									text = this.deliverType.SelectedValue;
									break;
								}
							}
							if (!string.IsNullOrEmpty(text))
							{
								string[] contentArray = text.ToString().Split(new char[]
								{
									'$'
								});
								string deliverChargeContentDetailByName = Shop_DeliverType.GetDeliverChargeContentDetailByName("defaultPrice", contentArray);
								if (!string.IsNullOrEmpty(deliverChargeContentDetailByName))
								{
									d2 = deliverChargeContentDetailByName.ToDecimal2();
								}
								string deliverChargeContentDetailByName2 = Shop_DeliverType.GetDeliverChargeContentDetailByName("deincrementPrice", contentArray);
								if (!string.IsNullOrEmpty(deliverChargeContentDetailByName2))
								{
									d3 = deliverChargeContentDetailByName2.ToDecimal2();
								}
								d = d2 + (num - 1) * d3;
							}
							IL_2FA:
							decimal d4 = 0m;
							if (!string.IsNullOrEmpty(this.txtInvoiceMonery.Text))
							{
								d4 = Convert.ToDecimal(this.txtInvoiceMonery.Text);
							}
							decimal num2 = d4 + d + this.m_Price * num;
							this.hfTotalMoney.Value = num2.ToString();
							decimal d5 = num2;
							this.ddlCoupon.Items.Clear();
							DataTable dataTable = base.UserUseCouponMethod(base.user.UserName, Web_ShopBuy.m_ProductID, "use", "myself", base.user.GroupID.ToString());
							if (dataTable != null)
							{
								for (int i = 0; i < dataTable.Rows.Count; i++)
								{
									decimal d6 = Convert.ToDecimal(dataTable.Rows[i]["NeedsMoney"].ToString());
									if (d5 >= d6)
									{
										this.Product_Need_Coupon.Style["display"] = "block";
										ListItem listItem = new ListItem();
										listItem.Text = dataTable.Rows[i]["CouponNum"].ToString() + " -- " + dataTable.Rows[i]["CouponParvalue"].ToString();
										listItem.Value = dataTable.Rows[i]["CouponItemID"].ToString();
										this.ddlCoupon.Items.Add(listItem);
									}
								}
								ListItem item = new ListItem("请选择", "");
								this.ddlCoupon.Items.Insert(0, item);
							}
						}
					}
				}
			}
		}
	}
	public void hideAddress()
	{
		if (base.user.UserName == "游客")
		{
			this.manage_address_tr.Attributes.Add("style", "display:none;width:100%;");
			this.show_new_address.Attributes.Add("style", "display:block;width:100%;");
		}
	}
	protected void BindPage()
	{
		if (Web_ShopBuy.m_ProductID <= 0)
		{
			this.WriteErrMsg("", Language.Get("Common/NotData"), "");
		}
		DataTable productByID = this.m_product.GetProductByID(Web_ShopBuy.m_ProductID);
		if (productByID.Rows.Count <= 0)
		{
			this.WriteErrMsg("", Language.Get("Common/NotData"), "");
		}
		this.row = productByID.Rows[0];
		this.m_SalerID = Convert.ToInt32(this.row["SalerID"]);
		if (this.row["ProductType"].ToString() == "4")
		{
			this.Amount.Enabled = false;
		}
		if (this.row["EnableSingleSell"].ToString() == "False" || this.row["EnableSingleSell"].ToString() == "0" || this.row["EnableSale"].ToString() == "False" || this.row["EnableSale"].ToString() == "0")
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/EnableSale"), "");
		}
		if (Convert.ToInt32(this.row["LeftTime"]) <= 0)
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/LeftTime"), "");
		}
		if (Convert.ToInt32(this.row["Stocks"]) < 1)
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/StocksLess"), "");
		}
		DateTime value = Convert.ToDateTime(this.row["BeginDate"]);
		if (DateTime.Now.Subtract(value).TotalSeconds < 0.0)
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/NotStartSale"), "");
		}
		this.m_SalerID = Convert.ToInt32(this.row["SalerID"]);
		if (base.user.UserID == this.m_SalerID)
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/BuySelf"), "");
		}
		bool flag = Convert.ToBoolean(this.row["IsApprove"]);
		DateTime t = Convert.ToDateTime(this.row["BeginDate"].ToString());
		if (this.m_SalerID != base.user.UserID)
		{
			string groupPower = base.user.GetGroupPower("GroupPower");
			if (groupPower.Contains("allowproduceApproval"))
			{
				if (!flag)
				{
					this.WriteErrMsg("", Language.Get("Common/NoApprove"), "");
				}
			}
		}
		else
		{
			if (!flag)
			{
				base.ClientScript.RegisterClientScriptBlock(typeof(Page), "", "<script>alert('该商品还处在审核期间！')</script>");
			}
			if (t < DateTime.Now)
			{
				base.ClientScript.RegisterClientScriptBlock(typeof(Page), "", "<script>alert('销售时间未开始！')</script>");
			}
		}
		DataTable dataTable = this.conn.GetDataTable("select * from HLShop_ProductImg where ProductID=" + Web_ShopBuy.m_ProductID);
		if (dataTable != null && dataTable.Rows.Count != 0)
		{
			if (!string.IsNullOrEmpty(dataTable.Rows[0]["ImgPath1"].ToString()))
			{
				this.ProductImage.ImageUrl = dataTable.Rows[0]["ImgPath1"].ToString();
			}
			else
			{
				this.ProductImage.ImageUrl = "Skin/CommStyle/images/noneimg.jpg";
			}
		}
		else
		{
			this.ProductImage.ImageUrl = "Skin/CommStyle/images/noneimg.jpg";
		}
		this.ProductImage.Attributes.Add("onload", "return MyResizeImage(this)");
		this.ProductName.Text = this.row["ProductName"].ToString();
		this.ProductName.NavigateUrl = "ShowProduct.aspx?ProductID=" + Web_ShopBuy.m_ProductID.ToString();
		if (this.row["ProductType"].ToString() == "1" && this.Session["newprice"] != null)
		{
			this.ProductPrice.Text = this.Session["newprice"].ToString();
		}
		else
		{
			if (this.row["ProductType"].ToString() == "2")
			{
				this.ProductPrice.Text = this.row["CurrentPrice"].ToString();
			}
			else
			{
				this.ProductPrice.Text = this.row["StandPrice"].ToString();
			}
		}
		this.CanBuy.Text = this.row["Stocks"].ToString();
		if (this.Session["buyStock"] != null)
		{
			this.CanBuy.Text = this.Session["buyStock"].ToString();
		}
		string text = base.Request.QueryString["count"];
		int num = 1;
		if (string.IsNullOrEmpty(text) || !int.TryParse(text, out num))
		{
			this.Amount.Text = "1";
		}
		else
		{
			this.Amount.Text = num.ToString();
		}
		this.txtInvoiceHead.Text = base.user.UserName;
		this.txtInvoiceName.Text = this.ProductName.Text;
		string text2 = this.row["TaxRate"].ToString();
		int num2 = Convert.ToInt32(this.Amount.Text);
		this.txtInvoiceMonery.Text = (double.Parse(this.ProductPrice.Text) * double.Parse(text2) * 0.01 * (double)num2).ToString();
		if (Convert.ToBoolean(this.row["NeedInvoice"]))
		{
			this.Product_Need_Invoice.Visible = true;
			this.Invoice_Need.Text = string.Format(this.Invoice_Need.Text, text2);
		}
		else
		{
			this.Product_Need_Invoice.Visible = false;
			this.Invoice_Need.Checked = false;
		}
		if (this.Session["GuiGe"] != null)
		{
			this.HiddenField2.Value = this.Session["GuiGe"].ToString();
		}
		this.ShowProType = this.row["ProductType"].ToString();
		string text3 = this.row["ProductType"].ToString();
		if (text3 != null)
		{
			if (text3 == "1")
			{
				this.ShowPrice.Visible = true;
				this.ShowAuction.Visible = false;
				this.TeamBuyPanel.Visible = false;
				this.ShowPromote.Visible = false;
				if (this.Session["newprice"] != null)
				{
					this.m_Price = Convert.ToDecimal(this.Session["newprice"]);
					this.HiddenField1.Value = this.Session["newprice"].ToString();
				}
				else
				{
					this.m_Price = Convert.ToDecimal(this.Session["StandPrice"]);
				}
				this.ProductPrice.Text = this.m_Price.ToString();
				this.TxtStardPrice.Text = this.m_Price.ToString();
				goto IL_FA2;
			}
			if (text3 == "2")
			{
				this.Amount.Text = "1";
				this.Amount.Enabled = false;
				this.m_Price = Convert.ToDecimal(this.row["CurrentPrice"]);
				decimal num3 = this.m_Price + Convert.ToDecimal(this.row["ImcrementPrice"]);
				this.AuctionCurrentPrice.Text = num3.ToString();
				this.AuctionCurrentPrice2.Text = num3.ToString();
				this.AuctionEndPrice.Text = num3.ToString();
				this.ProductPrice.Text = this.m_Price.ToString();
				this.ShowAuction.Visible = true;
				this.ShowPrice.Visible = false;
				this.TeamBuyPanel.Visible = false;
				this.ShowPromote.Visible = false;
				goto IL_FA2;
			}
			if (text3 == "3")
			{
				DataTable dataTable2 = this.conn.GetDataTable("select * from HLShop_TeamRecords where ProductID=" + Web_ShopBuy.m_ProductID);
				int num4 = 0;
				int num5 = 0;
				decimal num6 = Convert.ToDecimal(this.row["StandPrice"]);
				if (Fetch.Get("origin_buy") == "1")
				{
					this.m_Price = Convert.ToDecimal(this.row["StandPrice"]);
					this.ProductPrice.Text = this.m_Price.ToString();
					this.TeamBuyPanel.Visible = false;
				}
				else
				{
					decimal d = Text.ToDecimal(this.row["TempSubScriptionRate"]);
					int num7 = Convert.ToInt32(this.row["TeamNum"]);
					this.m_Price = Convert.ToDecimal(this.row["CurrentPrice"]);
					string text4 = this.row["TeamName"].ToString();
					if (num7 > 0)
					{
						string[] array = text4.Split(new char[]
						{
							','
						});
						DataTable dataTable3 = new DataTable();
						dataTable3.Columns.Add("ID");
						dataTable3.Columns.Add("TeamName");
						dataTable3.Columns.Add("Price");
						dataTable3.Columns.Add("MemberNum");
						dataTable3.Columns.Add("DiffNum");
						for (int i = 1; i <= num7; i++)
						{
							if (dataTable2 != null && dataTable2.Rows.Count > 0)
							{
								num4 = Convert.ToInt32(dataTable2.Rows[0]["TeamNum" + i].ToString());
							}
							if (Convert.ToInt32(this.row["TeamNumber" + i]) - num4 >= 0)
							{
								num5 = Convert.ToInt32(this.row["TeamNumber" + i]) - num4;
							}
							object[] values = new object[]
							{
								i,
								array[i - 1],
								this.row["TeamPrice" + i],
								this.row["TeamNumber" + i],
								num5
							};
							dataTable3.Rows.Add(values);
						}
						this.repotherBus.DataSource = dataTable3;
						this.repotherBus.DataBind();
					}
					else
					{
						this.TeamBuyPanel.Visible = false;
						this.otherChoice.Visible = false;
					}
					this.ProductPrice.Text = this.m_Price.ToString();
					this.ProductPrice.Text = num6.ToString();
					if (d > 0m)
					{
						Literal expr_D74 = this.ProductPrice;
						expr_D74.Text = expr_D74.Text + "(预付定金：" + d.ToString() + "%)";
					}
					this.ShowAuction.Visible = false;
					this.ShowPrice.Visible = false;
					this.TeamBuyPanel.Visible = true;
					this.ShowPromote.Visible = false;
				}
				goto IL_FA2;
			}
			if (text3 == "4")
			{
				this.ShowPromote.Visible = true;
				this.ShowPrice.Visible = false;
				this.ShowAuction.Visible = false;
				this.TeamBuyPanel.Visible = false;
				this.m_Price = Convert.ToDecimal(this.row["StandPrice"]);
				this.TextBox_Promote.Text = this.m_Price.ToString();
				goto IL_FA2;
			}
			if (text3 == "5")
			{
				this.ShowPrice.Visible = false;
				this.ShowAuction.Visible = false;
				this.TeamBuyPanel.Visible = false;
				this.ShowPromote.Visible = false;
				this.ShowNeedPresentExp.Visible = true;
				this.lblNeedPresentExp.Text = this.row["NeedPresentExp"].ToString();
				if (!string.IsNullOrEmpty(this.lblNeedPresentExp.Text))
				{
					int num8 = Convert.ToInt32(this.lblNeedPresentExp.Text) * Convert.ToInt32(this.Amount.Text);
					if (num8 > base.user.UserEP)
					{
						this.WriteErrMsg("", string.Concat(new object[]
						{
							"您的积分不足!您当前的积分为",
							base.user.UserEP,
							"，所需积分是",
							num8,
							"，还差",
							num8 - base.user.UserEP,
							"积分!"
						}), "ShowProduct.aspx?productid=" + Web_ShopBuy.m_ProductID);
					}
				}
				goto IL_FA2;
			}
		}
		this.m_Price = Convert.ToDecimal(this.row["StandPrice"]);
		IL_FA2:
		this.m_deliverPayType = this.row["DeliverPayType"].ToString();
		if (this.m_deliverPayType != "0")
		{
			if (!Text.IsNumber(this.row["DeliverType"].ToString()))
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/DeliverTypeErr"), "");
			}
			this.Delive_Type_ID = Convert.ToInt32(this.row["DeliverType"]);
		}
		this.hfdeliverPayType.Value = this.m_deliverPayType;
		text3 = this.m_deliverPayType;
		if (text3 != null)
		{
			if (!(text3 == "0"))
			{
				if (!(text3 == "1"))
				{
					if (text3 == "2")
					{
						this.DroDeliverPayType.Text = Language.Get("Shop/Deliver/DeliverPayType/Type2");
					}
				}
				else
				{
					this.DroDeliverPayType.Text = Language.Get("Shop/Deliver/DeliverPayType/Type1");
				}
			}
			else
			{
				this.DroDeliverPayType.Text = Language.Get("Shop/Deliver/DeliverPayType/Type0");
				this.confirDeliver.Visible = false;
			}
		}
		if (this.hfdeliverPayType.Value != "0")
		{
			ArrayList deliverFashionName = this.shop_deliver.GetDeliverFashionName(this.Delive_Type_ID);
			this.rblDeliverFashion.Items.Clear();
			if (deliverFashionName != null)
			{
				for (int j = 0; j < deliverFashionName.Count; j++)
				{
					string text5 = deliverFashionName[j].ToString();
					string[] array2 = text5.Split(new char[]
					{
						'|'
					});
					if (array2.Length > 1)
					{
						ListItem listItem = new ListItem();
						listItem.Text = array2[1].ToString();
						listItem.Value = text5;
						this.rblDeliverFashion.Items.Add(listItem);
					}
				}
			}
			if (this.rblDeliverFashion.Items.Count > 0)
			{
				this.rblDeliverFashion.Items[0].Selected = true;
				this.shop_deliver.GetDeliverTypeInfoByFashionName(this.rblDeliverFashion.SelectedValue, this.deliverType);
			}
		}
		string text6 = Text.CheckNumList(this.row["PayType"].ToString());
		Shop_PayType shop_PayType = new Shop_PayType(this.conn);
		DataTable unDisabledPayTypeByUserID = shop_PayType.GetUnDisabledPayTypeByUserID(this.m_SalerID);
		string text7 = this.row["PayType"].ToString();
		this.PayType.DataSource = unDisabledPayTypeByUserID;
		productByID.Dispose();
		this.PayType.DataBind();
		if (base.user.UserName == "游客")
		{
			Panel panel = (Panel)this.PayType.Controls[0].FindControl("TRMallPay");
			panel.Visible = false;
		}
	}
	protected void ImageButton1_Click(object sender, CommandEventArgs e)
	{
		if (base.user.UserName == "游客")
		{
			if (!this.IsExistPayType())
			{
				this.WriteErrMsg("", "该卖家没有设置有支付方式无法购买！", "");
			}
		}
		CreateOrder createOrder = new CreateOrder(this.conn);
		if (Web_ShopBuy.m_ProductID <= 0)
		{
			this.WriteErrMsg("", Language.Get("Common/NotData"), "");
		}
		DataTable productByID = this.m_product.GetProductByID(Web_ShopBuy.m_ProductID);
		if (productByID.Rows.Count <= 0)
		{
			this.WriteErrMsg("", Language.Get("Common/NotData"), "");
		}
		DataRow dataRow = productByID.Rows[0];
		this.m_SalerID = Convert.ToInt32(dataRow["SalerID"]);
		if (dataRow["PUnit"] != DBNull.Value)
		{
			string text = dataRow["PUnit"].ToString();
		}
		string text2 = dataRow["ProductName"].ToString();
		int num = Convert.ToInt32(dataRow["ShopID"]);
		string text3 = dataRow["ProductType"].ToString();
		string userName = base.user.UserName;
		UserBll userBll = new UserBll(this.conn);
		string userNameByID = userBll.GetUserNameByID(this.m_SalerID);
		string selectedValue = this.RadioButtonList_InvoiceType.SelectedValue;
		string contacterName = this.ContacterName.Text;
		string mobile = this.mobilePhone.Text;
		string phone = this.homePhone.Text;
		string address = this.Address.Text;
		string text4 = this.Remark.Text;
		string email = this.Email.Text;
		string text5 = this.zipCode.Text;
		string province = this.ddlProvince.GetSelectValue(new string[0]);
		string text6 = this.ddlCity.GetSelectValue(new string[0]);
		string area = "";
		if (!string.IsNullOrEmpty(this.ddlArea.GetSelectValue(new string[0])))
		{
			area = this.ddlArea.GetSelectValue(new string[0]);
		}
		address = "";
		if (this.my_receive_address.SelectedValue != "")
		{
			Shop_Address shop_Address = new Shop_Address(this.conn);
			DataTable addressByID = shop_Address.GetAddressByID(Convert.ToInt32(this.my_receive_address.SelectedValue), this.m_BuyUserID);
			if (addressByID.Rows.Count > 0)
			{
				contacterName = addressByID.Rows[0]["UserName"].ToString();
				province = addressByID.Rows[0]["Province"].ToString();
				text6 = addressByID.Rows[0]["City"].ToString();
				mobile = addressByID.Rows[0]["MobilePhone"].ToString();
				phone = addressByID.Rows[0]["ConectPhone"].ToString();
				address = addressByID.Rows[0]["Address"].ToString();
				text5 = addressByID.Rows[0]["ZipCode"].ToString();
				email = addressByID.Rows[0]["Email"].ToString();
			}
		}
		Shop_DeliverType shop_DeliverType = new Shop_DeliverType(this.conn);
		bool flag = false;
		string deliverTypeName = "";
		decimal num2 = 0m;
		decimal num3 = 0m;
		int deliverTypeID = 0;
		if (dataRow["DeliverType"] != DBNull.Value)
		{
			deliverTypeID = Convert.ToInt32(dataRow["DeliverType"].ToString());
		}
		string deliverCharge = "";
		string value = this.hfdeliverPayType.Value;
		if (value != null)
		{
			if (value == "0")
			{
				goto IL_527;
			}
		}
		string text7 = "";
		for (int i = 0; i < this.deliverType.Items.Count; i++)
		{
			if (this.deliverType.Items[i].Selected)
			{
				text7 = this.deliverType.SelectedValue;
				flag = true;
				break;
			}
		}
		if (!string.IsNullOrEmpty(text7))
		{
			string[] contentArray = text7.ToString().Split(new char[]
			{
				'$'
			});
			deliverTypeName = Shop_DeliverType.GetDeliverChargeContentDetailByName("deliverName", contentArray);
			string deliverChargeContentDetailByName = Shop_DeliverType.GetDeliverChargeContentDetailByName("defaultPrice", contentArray);
			if (!string.IsNullOrEmpty(deliverChargeContentDetailByName))
			{
				num3 = deliverChargeContentDetailByName.ToDecimal2();
			}
			string deliverChargeContentDetailByName2 = Shop_DeliverType.GetDeliverChargeContentDetailByName("deincrementPrice", contentArray);
			if (!string.IsNullOrEmpty(deliverChargeContentDetailByName2))
			{
				num2 = deliverChargeContentDetailByName2.ToDecimal2();
			}
			deliverCharge = text7;
		}
		IL_527:
		int num4 = Convert.ToInt32(this.Amount.Text);
		int orderID = 0;
		string str = "";
		bool @checked = this.Invoice_Need.Checked;
		DateTime updateTime = DateTime.Now;
		decimal d = 0m;
		int num5 = 0;
		bool flag2 = false;
		bool flag3 = false;
		decimal num6 = 0m;
		int num7 = 0;
		int num8 = 0;
		decimal num9 = Convert.ToDecimal(dataRow["CurrentPrice"]);
		decimal num10 = 0m;
		if ((this.my_receive_address.SelectedValue == "" && (this.ContacterName.Text == "" || this.Address.Text == "")) || text6 == "")
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/BuyAdrres"), "");
		}
		if (this.hfdeliverPayType.Value != "0")
		{
			if (!flag)
			{
				this.WriteErrMsg("", Language.Get("Shop/Deliver/DeliverTypeNull"), "");
			}
		}
		if (Convert.ToInt32(dataRow["LeftTime"]) <= 0)
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/LeftTime"), "");
		}
		if (num4 <= 0)
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/BuyQuantityErr"), "");
		}
		if (Convert.ToInt32(dataRow["Stocks"]) < num4)
		{
			this.WriteErrMsg("", Language.Get("Shop/Product/BuyStocksErr"), "");
		}
		if (text3 == "2")
		{
			this.m_Price = Convert.ToDecimal(this.AuctionEndPrice.Text);
			decimal num11 = Convert.ToDecimal(dataRow["AuctionStartPrice"]);
			num9 = Convert.ToDecimal(dataRow["CurrentPrice"]);
			decimal d2 = Convert.ToDecimal(dataRow["ImcrementPrice"]);
			if (this.m_Price < num9 + d2 || this.m_Price <= num11)
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/AuctionPriceLow"), "");
			}
			decimal d3 = decimal.Truncate((this.m_Price - num11) / d2);
			num6 = (this.m_Price = d3 * d2 + num11);
			Shop_Order shop_Order = new Shop_Order(this.conn);
			DataTable maxAuctionPriceByProductID = shop_Order.GetMaxAuctionPriceByProductID(Convert.ToInt32(dataRow["ProductID"]), Convert.ToInt32(dataRow["Cycle"]), Convert.ToDecimal(dataRow["TempSubScriptionRate"]) != 0m);
			if (maxAuctionPriceByProductID.Rows.Count > 0)
			{
				num8 = Convert.ToInt32(maxAuctionPriceByProductID.Rows[0]["OrderFormID"]);
				if (base.user.UserID == Convert.ToInt32(maxAuctionPriceByProductID.Rows[0]["UserID"]))
				{
					this.WriteErrMsg("", Language.Get("Shop/Product/YouLeadErr"), "");
				}
			}
			if (Convert.ToDecimal(dataRow["TempSubScriptionRate"]) == 0m)
			{
				flag2 = true;
				decimal num12 = num11;
				if (num8 > 0)
				{
					num12 = Convert.ToDecimal(maxAuctionPriceByProductID.Rows[0]["AuctionEndPrice"]);
				}
				if (num6 > num12)
				{
					num5 = 1;
					num9 = (this.m_Price = num12 + d2);
				}
				else
				{
					if (num6 < num12)
					{
						num5 = 0;
						this.m_Price = num6;
						num9 = num6 + d2;
					}
					else
					{
						if (num6 == num12)
						{
							num5 = 0;
							this.m_Price = num6;
							num9 = num6;
						}
					}
				}
			}
			else
			{
				DataTable lastOrder = shop_Order.GetLastOrder(Web_ShopBuy.m_ProductID, base.user.UserID, Convert.ToInt32(dataRow["Cycle"]));
				if (lastOrder.Rows.Count > 0)
				{
					d = Convert.ToDecimal(lastOrder.Rows[0]["MoneyReceipt"]);
					if (d <= 0m)
					{
						this.WriteErrMsg("", Language.Get("Shop/Product/AuctionNotPay"), "/Member/Index.aspx?mainurl=Shop_BuyOrder.aspx?OrderFormNum=" + lastOrder.Rows[0]["MoneyReceipt"]);
					}
				}
				if (d > 0m)
				{
					flag2 = true;
					decimal num12 = num11;
					if (num8 > 0)
					{
						num12 = Convert.ToDecimal(maxAuctionPriceByProductID.Rows[0]["AuctionEndPrice"]);
					}
					if (num6 > num12)
					{
						num5 = 1;
						num9 = (this.m_Price = num12 + d2);
					}
					else
					{
						if (num6 < num12)
						{
							num5 = 0;
							this.m_Price = num6;
							num9 = num6 + d2;
						}
						else
						{
							if (num6 == num12)
							{
								num5 = 0;
								this.m_Price = num6;
								num9 = num6;
							}
						}
					}
				}
				else
				{
					num10 = this.m_Price * (Convert.ToDecimal(dataRow["TempSubScriptionRate"]) / 100m);
					if (base.user.Balance < num10 && num10 > 0m)
					{
						this.WriteErrMsg("友情提示！", "您的帐户余额不足，请先充值！", "");
					}
					flag2 = true;
					decimal num12 = num11;
					if (num8 > 0)
					{
						num12 = Convert.ToDecimal(maxAuctionPriceByProductID.Rows[0]["AuctionEndPrice"]);
					}
					if (num6 > num12)
					{
						num5 = 1;
						num9 = (this.m_Price = num12 + d2);
					}
					else
					{
						if (num6 < num12)
						{
							num5 = 0;
							this.m_Price = num6;
							num9 = num6 + d2;
						}
						else
						{
							if (num6 == num12)
							{
								num5 = 0;
								this.m_Price = num6;
								num9 = num6;
							}
						}
					}
					flag3 = true;
				}
			}
			updateTime = Convert.ToDateTime(dataRow["EndDate"]);
			num4 = 1;
		}
		if (text3 == "3" && Fetch.GetOrPost("origin_buy") != "1")
		{
			Shop_Product shop_Product = new Shop_Product();
			num7 = 5;
			if (this.otherChoice.SelectedValue == "0")
			{
				num7 = Convert.ToInt32(dataRow["TeamNum"].ToString());
			}
			else
			{
				string orPost = Fetch.GetOrPost("TeamBuyLeavel");
				if (!string.IsNullOrEmpty(orPost))
				{
					num7 = Convert.ToInt32(orPost);
				}
				else
				{
					this.WriteErrMsg("", "请选择团购时的巴士价项！", "");
				}
			}
			int num13;
			int num14;
			if (shop_Product.JustAchievingMen(Web_ShopBuy.m_ProductID))
			{
				num13 = this.conn.ExecuteCount("select count(*) from HLShop_Order where Cycle=(select max(Cycle) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + Web_ShopBuy.m_ProductID + ") and Remembereffect=1");
				num14 = this.conn.ExecuteCount("select count(*) from HLShop_Order where Cycle=(select max(a.Cycle) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + Web_ShopBuy.m_ProductID + ")");
			}
			else
			{
				num13 = this.conn.ExecuteCount("select count(*) from HLShop_Order where Cycle=(select max(Cycle-1) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + Web_ShopBuy.m_ProductID + ") and Remembereffect=1");
				num14 = this.conn.ExecuteCount("select count(*) from HLShop_Order where Cycle=(select max(a.Cycle-1) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + Web_ShopBuy.m_ProductID + ")");
			}
			if (num13 == num14 && num14 != 0)
			{
				this.WriteErrMsg("友情提示！", "上期的团购卖家还在处理中，请稍后。。。", "");
				return;
			}
			this.m_Price = Convert.ToDecimal(dataRow["TeamPrice" + num7]);
			num10 = this.m_Price * Convert.ToDecimal(num4) * (Convert.ToDecimal(dataRow["TempSubScriptionRate"]) / 100m);
			if (num10 > 0m)
			{
				if (base.user.Balance < num10)
				{
					this.WriteErrMsg("友情提示！", "您的帐户余额不足，请先充值！", "");
				}
				flag3 = true;
			}
			updateTime = Convert.ToDateTime(dataRow["EndDate"]);
		}
		else
		{
			if (Fetch.GetOrPost("origin_buy") == "1")
			{
				text3 = "1";
			}
		}
		if (text3 == "3")
		{
			this.TeamBeforeCycleNum = this.conn.ExecuteCount("select count(*) from HLShop_Order as a left join HLShop_OrderItem as b on a.OrderFormID=b.OrderFormID where a.TradeType=3 and a.Teameffect=1 and b.ProductID=" + Web_ShopBuy.m_ProductID);
			this.TotalBeforeNumber = this.conn.ExecuteCount("select count(*) from HLShop_Order as a left join HLShop_OrderItem as b on a.OrderFormID=b.OrderFormID where a.TradeType=3 and a.Teameffect<>1 and b.ProductID=" + Web_ShopBuy.m_ProductID);
		}
		if (text3 == "1")
		{
			if (this.Session["newprice"] != null)
			{
				this.m_Price = Convert.ToDecimal(this.Session["newprice"]);
			}
			else
			{
				this.m_Price = Text.ToDecimal(dataRow["StandPrice"].ToString());
			}
		}
		if (text3 == "4")
		{
			if (createOrder.UserOneSecondsKill(base.user.UserID, Web_ShopBuy.m_ProductID))
			{
				this.WriteErrMsg("", "秒杀商品不能重复购买！", "");
			}
			this.m_Price = Text.ToDecimal(dataRow["StandPrice"].ToString());
		}
		if (text3 == "5")
		{
			this.m_Price = Text.ToDecimal(dataRow["StandPrice"].ToString());
		}
		createOrder.UserID = base.user.UserID;
		createOrder.BuyerName = base.user.UserName;
		createOrder.SalerID = this.m_SalerID;
		createOrder.SalerName = userNameByID;
		createOrder.ShopID = num;
		createOrder.TradeType = Convert.ToInt32(text3);
		createOrder.Remark = text4;
		createOrder.ContacterName = contacterName;
		createOrder.Province = province;
		createOrder.City = text6;
		createOrder.Area = area;
		createOrder.Email = email;
		createOrder.Mobile = mobile;
		createOrder.Phone = phone;
		createOrder.Address = address;
		createOrder.ZipCode = text5;
		createOrder.Status = num5;
		createOrder.MoneyGoods = this.m_Price * num4;
		createOrder.Cycle = Convert.ToInt32(dataRow["Cycle"]);
		createOrder.TeamBuyLeavel = num7;
		createOrder.AuctionEndPrice = num6;
		createOrder.UpdateTime = updateTime;
		createOrder.DeliverTypeName = deliverTypeName;
		createOrder.DeliverPrice = num3;
		createOrder.Increment = num2;
		createOrder.DeliverTypeID = deliverTypeID;
		createOrder.DeliverCharge = deliverCharge;
		if (this.Invoice_Need.Checked)
		{
			createOrder.InvoiceType = selectedValue;
		}
		createOrder.SelectedPayType = Convert.ToInt32(this.hfSelectPayType.Value);
		createOrder.GuiGe = this.HiddenField2.Value;
		if (text3 == "2" || text3 == "3")
		{
			createOrder.isSingle = true;
		}
		int num15 = 0;
		if (this.Product_Need_Coupon.Style["display"] == "block")
		{
			for (int i = 0; i < this.ddlCoupon.Items.Count; i++)
			{
				if (this.ddlCoupon.Items[i].Selected)
				{
					if (this.ddlCoupon.Items[i].Value != "")
					{
						num15 = Convert.ToInt32(this.ddlCoupon.Items[i].Value);
					}
				}
			}
		}
		bool flag4 = createOrder.AddOrder(Web_ShopBuy.m_ProductID, num4, @checked ? 1 : 0, this.m_Price, num3, num2, num15);
		orderID = createOrder.OrderFormID;
		str = createOrder.OrderFormNum;
		if (flag4)
		{
			if (this.Invoice_Need.Checked)
			{
				try
				{
					int num16 = Convert.ToInt32(this.txtInvoiceMonery.Text);
				}
				catch
				{
				}
			}
			int productnum = Convert.ToInt32(this.Amount.Text);
			if (!(text3 == "1"))
			{
				if (text3 == "2")
				{
					this.conn.Execute(string.Concat(new object[]
					{
						"Update [HLShop_Product] Set CurrentPrice=",
						num9,
						",StandPrice=",
						num9,
						" Where ProductID=",
						Web_ShopBuy.m_ProductID
					}));
					if (flag2)
					{
						Shop_Order shop_Order = new Shop_Order(this.conn);
						DataTable maxAuctionPriceByProductID = shop_Order.GetMaxAuctionPriceByProductID(Convert.ToInt32(dataRow["ProductID"]), Convert.ToInt32(dataRow["Cycle"]), Convert.ToDecimal(dataRow["TempSubScriptionRate"]) != 0m);
						int num17 = int.Parse(maxAuctionPriceByProductID.Rows[0]["OrderFormID"].ToString());
						if (num17 > 0)
						{
							if (num5 == 1)
							{
								shop_Order.AddAuctionOrderByAgent(num17);
							}
							else
							{
								shop_Order.AddAuctionOrderByAgent(num9, num17, 0);
							}
						}
					}
					if (flag3)
					{
						OrderAction orderAction = new OrderAction(this.conn);
						orderAction.ShopBankPayOrder(base.user.UserID, orderID, num10, "拍卖预付", 0m, false, base.shopconfig["PayFee"].ToString(), 0m);
					}
				}
				else
				{
					if (text3 == "3")
					{
						Shop_Product shop_Product2 = new Shop_Product();
						int num18 = 0;
						bool flag5 = false;
						DataTable dataTable = this.conn.GetDataTable("select TempSubScriptionRate from HLShop_Product where ProductID=" + Web_ShopBuy.m_ProductID);
						decimal d4 = Convert.ToDecimal(dataTable.Rows[0]["TempSubScriptionRate"].ToString());
						dataTable.Dispose();
						if (this.otherChoice.SelectedValue == "1")
						{
							if (!string.IsNullOrEmpty(Fetch.GetOrPost("TeamBuyLeavel")))
							{
								num18 = int.Parse(Fetch.GetOrPost("TeamBuyLeavel"));
							}
						}
						else
						{
							DataTable dataTable2 = this.conn.GetDataTable("select TeamNum from HLShop_Product where ProductID=" + Web_ShopBuy.m_ProductID);
							int num19 = int.Parse(dataTable2.Rows[0]["TeamNum"].ToString());
							num18 = num19;
							dataTable2.Dispose();
						}
						if (num18 > 0)
						{
							if (d4 <= 0m)
							{
								string text8 = string.Concat(new object[]
								{
									"TeamCurrentNumber",
									num18,
									" = TeamCurrentNumber",
									num18,
									" + ",
									num4
								});
								this.conn.Execute(string.Concat(new object[]
								{
									"Update [HLShop_Product] Set ",
									text8,
									" Where ProductID=",
									Web_ShopBuy.m_ProductID
								}));
							}
						}
						string sql = "Select TempSubScriptionRate,TeamNum,TeamCurrentNumber1,TeamNumber1,TeamPrice1,TeamCurrentNumber2,TeamNumber2,TeamPrice2, TeamCurrentNumber3,TeamNumber3,TeamPrice3,TeamCurrentNumber4,TeamNumber4,TeamPrice4,TeamCurrentNumber5,TeamNumber5,TeamPrice5 From [HLShop_Product] Where ProductID=" + Web_ShopBuy.m_ProductID;
						DataTable dataTable3 = this.conn.GetDataTable(sql);
						int num20 = Convert.ToInt32(dataTable3.Rows[0]["TeamCurrentNumber1"]);
						int num21 = Convert.ToInt32(dataTable3.Rows[0]["TeamCurrentNumber2"]);
						int num22 = Convert.ToInt32(dataTable3.Rows[0]["TeamCurrentNumber3"]);
						int num23 = Convert.ToInt32(dataTable3.Rows[0]["TeamCurrentNumber4"]);
						int num24 = Convert.ToInt32(dataTable3.Rows[0]["TeamCurrentNumber5"]);
						int num25 = Convert.ToInt32(dataTable3.Rows[0]["TeamNumber1"]);
						int num26 = Convert.ToInt32(dataTable3.Rows[0]["TeamNumber2"]);
						int num27 = Convert.ToInt32(dataTable3.Rows[0]["TeamNumber3"]);
						int num28 = Convert.ToInt32(dataTable3.Rows[0]["TeamNumber4"]);
						int num29 = Convert.ToInt32(dataTable3.Rows[0]["TeamNumber5"]);
						decimal num30 = Convert.ToDecimal(dataTable3.Rows[0]["TeamPrice1"]);
						decimal num31 = Convert.ToDecimal(dataTable3.Rows[0]["TeamPrice2"]);
						decimal num32 = Convert.ToDecimal(dataTable3.Rows[0]["TeamPrice3"]);
						decimal num33 = Convert.ToDecimal(dataTable3.Rows[0]["TeamPrice4"]);
						decimal num34 = Convert.ToDecimal(dataTable3.Rows[0]["TeamPrice5"]);
						int num35 = Convert.ToInt32(dataTable3.Rows[0]["TeamNum"]);
						int num36 = 0;
						int num37 = 0;
						int num38 = 0;
						int num39 = 0;
						int num40 = 0;
						int num41 = 0;
						int num42 = 0;
						int num43 = 0;
						int num44 = 0;
						int num45 = 0;
						DataTable dataTable4 = this.conn.GetDataTable("select * from HLShop_TeamRecords where ProductID=" + Web_ShopBuy.m_ProductID);
						if (dataTable4 != null && dataTable4.Rows.Count > 0)
						{
							num36 = int.Parse(dataTable4.Rows[0]["TeamNum1"].ToString());
							num37 = int.Parse(dataTable4.Rows[0]["TeamNum2"].ToString());
							num38 = int.Parse(dataTable4.Rows[0]["TeamNum3"].ToString());
							num39 = int.Parse(dataTable4.Rows[0]["TeamNum4"].ToString());
							num40 = int.Parse(dataTable4.Rows[0]["TeamNum5"].ToString());
						}
						dataTable4.Dispose();
						if (this.otherChoice.SelectedValue == "1")
						{
							if (d4 <= 0m)
							{
								switch (num35)
								{
								case 1:
									num36 = num20;
									num9 = num30;
									break;
								case 2:
									if (num18 == 1)
									{
										num36 = num20;
										num37 = num20 + num21;
										num9 = num30;
									}
									else
									{
										num37 = num20 + num21;
										num9 = num31;
									}
									break;
								case 3:
									if (num18 == 1)
									{
										num36 = num20;
										num37 = num20 + num21;
										num38 = num20 + num21 + num22;
										num9 = num30;
									}
									else
									{
										if (num18 == 2)
										{
											num37 = num20 + num21;
											num38 = num20 + num21 + num22;
											num9 = num31;
										}
										else
										{
											num38 = num20 + num21 + num22;
											num9 = num32;
										}
									}
									break;
								case 4:
									if (num18 == 1)
									{
										num36 = num20;
										num37 = num20 + num21;
										num38 = num20 + num21 + num22;
										num39 = num20 + num21 + num22 + num23;
										num9 = num30;
									}
									else
									{
										if (num18 == 2)
										{
											num37 = num20 + num21;
											num38 = num20 + num21 + num22;
											num39 = num20 + num21 + num22 + num23;
											num9 = num31;
										}
										else
										{
											if (num18 == 3)
											{
												num38 = num20 + num21 + num22;
												num39 = num20 + num21 + num22 + num23;
												num9 = num32;
											}
											else
											{
												num39 = num20 + num21 + num22 + num23;
												num9 = num33;
											}
										}
									}
									break;
								case 5:
									if (num18 == 1)
									{
										num36 = num20;
										num37 = num20 + num21;
										num38 = num20 + num21 + num22;
										num39 = num20 + num21 + num22 + num23;
										num40 = num20 + num21 + num22 + num23 + num24;
										num9 = num30;
									}
									else
									{
										if (num18 == 2)
										{
											num37 = num20 + num21;
											num38 = num20 + num21 + num22;
											num39 = num20 + num21 + num22 + num23;
											num40 = num20 + num21 + num22 + num23 + num24;
											num9 = num31;
										}
										else
										{
											if (num18 == 3)
											{
												num38 = num20 + num21 + num22;
												num39 = num20 + num21 + num22 + num23;
												num40 = num20 + num21 + num22 + num23 + num24;
												num9 = num32;
											}
											else
											{
												if (num18 == 4)
												{
													num39 = num20 + num21 + num22 + num23;
													num40 = num20 + num21 + num22 + num23 + num24;
													num9 = num33;
												}
												else
												{
													num40 = num20 + num21 + num22 + num23 + num24;
													num9 = num34;
												}
											}
										}
									}
									break;
								}
							}
						}
						else
						{
							if (d4 <= 0m)
							{
								switch (num35)
								{
								case 1:
									num36 = num20;
									num9 = num30;
									break;
								case 2:
									num37 = num20 + num21;
									num9 = num31;
									break;
								case 3:
									num38 = num20 + num21 + num22;
									num9 = num32;
									break;
								case 4:
									num39 = num20 + num21 + num22 + num23;
									num9 = num33;
									break;
								case 5:
									num40 = num20 + num21 + num22 + num23 + num24;
									num9 = num34;
									break;
								}
							}
						}
						if (d4 > 0m)
						{
							switch (num18)
							{
							case 1:
								num41 = num4;
								num9 = num30;
								break;
							case 2:
								num42 = num4;
								num9 = num31;
								break;
							case 3:
								num43 = num4;
								num9 = num32;
								break;
							case 4:
								num44 = num4;
								num9 = num33;
								break;
							case 5:
								num45 = num4;
								num9 = num34;
								break;
							}
							if (shop_Product2.ExistUserTeamRecord(this.m_BuyUserID, Web_ShopBuy.m_ProductID))
							{
								this.conn.Execute(string.Concat(new object[]
								{
									"Update HLUser_RecordTeam set TeamUserNum1=",
									num41,
									",TeamUserNum2=",
									num42,
									",TeamUserNum3=",
									num43,
									",TeamUserNum4=",
									num44,
									",TeamUserNum5=",
									num45,
									",TeamLeavel=",
									num18,
									" where UserID=",
									this.m_BuyUserID,
									" and ProductID=",
									Web_ShopBuy.m_ProductID
								}));
							}
							else
							{
								this.conn.Execute(string.Concat(new object[]
								{
									"insert into HLUser_RecordTeam([UserID],[ProductID],[TeamUserNum1],[TeamUserNum2],[TeamUserNum3],[TeamUserNum4],[TeamUserNum5],[TeamLeavel]) values(",
									this.m_BuyUserID,
									",",
									Web_ShopBuy.m_ProductID,
									",",
									num41,
									",",
									num42,
									",",
									num43,
									",",
									num44,
									",",
									num45,
									",",
									num18,
									")"
								}));
							}
						}
						if (shop_Product2.ExistTeamRecord(Web_ShopBuy.m_ProductID))
						{
							this.conn.Execute(string.Concat(new object[]
							{
								"Update HLShop_TeamRecords set TeamNum1=",
								num36,
								",TeamNum2=",
								num37,
								",TeamNum3=",
								num38,
								",TeamNum4=",
								num39,
								",TeamNum5=",
								num40,
								" where ProductID=",
								Web_ShopBuy.m_ProductID
							}));
						}
						else
						{
							int num46 = this.conn.Execute(string.Concat(new object[]
							{
								"insert into HLShop_TeamRecords ([TeamNum1],[TeamNum2],[TeamNum3],[TeamNum4],[TeamNum5],[ProductID]) values(",
								num36,
								",",
								num37,
								",",
								num38,
								",",
								num39,
								",",
								num40,
								",",
								Web_ShopBuy.m_ProductID,
								")"
							}));
						}
						int num47 = this.conn.Execute("Update [HLShop_Order] set AuctionEndPrice=" + num9 + ",Teameffect=0,Cycle=1 where OrderFormID=(select Max(OrderFormID) from HLShop_Order where TradeType=3) and TradeType=3");
						DataTable dataTable5 = this.conn.GetDataTable("select max(OrderFormID) as OrderFormID from HLShop_Order");
						int orderFormID = int.Parse(dataTable5.Rows[0]["OrderFormID"].ToString());
						dataTable5.Dispose();
						shop_Product2.UpdateEachOrderFormID(orderFormID, Web_ShopBuy.m_ProductID, num9);
						int num48 = 0;
						int num49 = 0;
						int num50 = 0;
						int num51 = 0;
						int num52 = 0;
						DataTable dataTable6 = this.conn.GetDataTable("select * from HLShop_TeamRecords where ProductID=" + Web_ShopBuy.m_ProductID);
						if (dataTable6 != null && dataTable6.Rows.Count > 0)
						{
							DataRow dataRow2 = dataTable6.Rows[0];
							num48 = int.Parse(dataRow2["TeamNum1"].ToString());
							num49 = int.Parse(dataRow2["TeamNum2"].ToString());
							num50 = int.Parse(dataRow2["TeamNum3"].ToString());
							num51 = int.Parse(dataRow2["TeamNum4"].ToString());
							num52 = int.Parse(dataRow2["TeamNum5"].ToString());
						}
						switch (num35)
						{
						case 1:
							if (num48 >= num25)
							{
								if (d4 <= 0m)
								{
									shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
								}
							}
							break;
						case 2:
							if (num49 >= num26)
							{
								if (d4 <= 0m)
								{
									shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
								}
							}
							else
							{
								if (num48 >= num25)
								{
									if (d4 <= 0m)
									{
										shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num49 - num48, "HLShop_TeamRecords", "TeamNum2");
									}
								}
							}
							break;
						case 3:
							if (num50 >= num27)
							{
								if (d4 <= 0m)
								{
									shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(3, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber3");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum3");
								}
							}
							else
							{
								if (num49 >= num26)
								{
									if (d4 <= 0m)
									{
										shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num50 - num49, "HLShop_TeamRecords", "TeamNum3");
									}
								}
								else
								{
									if (num48 >= num25)
									{
										if (d4 <= 0m)
										{
											shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num49 - num48, "HLShop_TeamRecords", "TeamNum2");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num50 - num48, "HLShop_TeamRecords", "TeamNum3");
										}
									}
								}
							}
							break;
						case 4:
							if (num51 >= num28)
							{
								if (d4 <= 0m)
								{
									shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(3, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(4, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber3");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum3");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber4");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum4");
								}
							}
							else
							{
								if (num50 >= num27)
								{
									if (d4 <= 0m)
									{
										shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeameffectOrder(3, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber3");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum3");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num51 - num50, "HLShop_TeamRecords", "TeamNum4");
									}
								}
								else
								{
									if (num49 >= num26)
									{
										if (d4 <= 0m)
										{
											shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
											shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num50 - num49, "HLShop_TeamRecords", "TeamNum3");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num51 - num49, "HLShop_TeamRecords", "TeamNum4");
										}
									}
									else
									{
										if (num48 >= num25)
										{
											if (d4 <= 0m)
											{
												shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num49 - num48, "HLShop_TeamRecords", "TeamNum2");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num50 - num48, "HLShop_TeamRecords", "TeamNum3");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num51 - num48, "HLShop_TeamRecords", "TeamNum4");
											}
										}
									}
								}
							}
							break;
						case 5:
							if (num52 >= num29)
							{
								if (d4 <= 0m)
								{
									shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(3, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(4, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeameffectOrder(5, 1, Web_ShopBuy.m_ProductID);
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber3");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum3");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber4");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum4");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber5");
									shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum5");
								}
							}
							else
							{
								if (num51 >= num28)
								{
									if (d4 <= 0m)
									{
										shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeameffectOrder(3, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeameffectOrder(4, 1, Web_ShopBuy.m_ProductID);
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber3");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum3");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber4");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum4");
										shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num52 - num51, "HLShop_TeamRecords", "TeamNum5");
									}
								}
								else
								{
									if (num50 >= num27)
									{
										if (d4 <= 0m)
										{
											shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
											shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
											shop_Product2.UpdateTeameffectOrder(3, 1, Web_ShopBuy.m_ProductID);
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber3");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum3");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num51 - num50, "HLShop_TeamRecords", "TeamNum4");
											shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num52 - num50, "HLShop_TeamRecords", "TeamNum5");
										}
									}
									else
									{
										if (num49 >= num26)
										{
											if (d4 <= 0m)
											{
												shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
												shop_Product2.UpdateTeameffectOrder(2, 1, Web_ShopBuy.m_ProductID);
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber2");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum2");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num50 - num49, "HLShop_TeamRecords", "TeamNum3");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num51 - num49, "HLShop_TeamRecords", "TeamNum4");
												shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num52 - num49, "HLShop_TeamRecords", "TeamNum5");
											}
										}
										else
										{
											if (num48 >= num25)
											{
												if (d4 <= 0m)
												{
													shop_Product2.UpdateTeameffectOrder(1, 1, Web_ShopBuy.m_ProductID);
													shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_Product", "TeamCurrentNumber1");
													shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, 0, "HLShop_TeamRecords", "TeamNum1");
													shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num49 - num48, "HLShop_TeamRecords", "TeamNum2");
													shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num50 - num48, "HLShop_TeamRecords", "TeamNum3");
													shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num51 - num48, "HLShop_TeamRecords", "TeamNum4");
													shop_Product2.UpdateTeamProductorRecord(Web_ShopBuy.m_ProductID, num52 - num48, "HLShop_TeamRecords", "TeamNum5");
												}
											}
										}
									}
								}
							}
							break;
						}
						this.TeamAfterCycleNum = this.conn.ExecuteCount("select count(*) from HLShop_Order as a left join HLShop_OrderItem as b on a.OrderFormID=b.OrderFormID where TradeType=3 and Teameffect=1 and b.ProductID=" + Web_ShopBuy.m_ProductID);
						this.TotalAfterNumber = this.conn.ExecuteCount("select count(*) from HLShop_Order as a left join HLShop_OrderItem as b on a.OrderFormID=b.OrderFormID where a.TradeType=3 and a.Teameffect<>1 and b.ProductID=" + Web_ShopBuy.m_ProductID);
						this.AddCycle();
						if (d4 <= 0m)
						{
							switch (num35)
							{
							case 2:
								if (num48 >= num25 && num49 < num26)
								{
									if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 1))
									{
										flag5 = true;
									}
								}
								break;
							case 3:
								if (num48 >= num25 && num49 < num26 && num50 < num27)
								{
									if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 1))
									{
										flag5 = true;
									}
								}
								else
								{
									if (num49 >= num26 && num50 < num27)
									{
										if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 2))
										{
											flag5 = true;
										}
									}
								}
								break;
							case 4:
								if (num48 >= num25 && num49 < num26 && num50 < num27 && num51 < num28)
								{
									if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 1))
									{
										flag5 = true;
									}
								}
								else
								{
									if (num49 >= num26 && num50 < num27 && num51 < num28)
									{
										if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 2))
										{
											flag5 = true;
										}
									}
									else
									{
										if (num50 >= num27 && num51 < num28)
										{
											if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 3))
											{
												flag5 = true;
											}
										}
									}
								}
								break;
							case 5:
								if (num48 >= num25 && num49 < num26 && num50 < num27 && num51 < num28 && num52 < num29)
								{
									if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 1))
									{
										flag5 = true;
									}
								}
								else
								{
									if (num49 >= num26 && num50 < num27 && num51 < num28 && num52 < num29)
									{
										if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 2))
										{
											flag5 = true;
										}
									}
									else
									{
										if (num50 >= num27 && num51 < num28 && num52 < num29)
										{
											if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 3))
											{
												flag5 = true;
											}
										}
										else
										{
											if (num51 >= num28 && num52 < num29)
											{
												if (shop_Product2.JustCycleSeparates(Web_ShopBuy.m_ProductID, 4))
												{
													flag5 = true;
												}
											}
										}
									}
								}
								break;
							}
							int cycle = 0;
							if (flag5)
							{
								DataTable dataTable7 = this.conn.GetDataTable("select top 1 Cycle from HLShop_Order where Cycle=(select max(Cycle-1) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + Web_ShopBuy.m_ProductID + ")");
								if (dataTable7 != null && dataTable7.Rows.Count > 0)
								{
									cycle = int.Parse(dataTable7.Rows[0]["Cycle"].ToString());
								}
								dataTable7.Dispose();
							}
							else
							{
								DataTable dataTable8 = this.conn.GetDataTable("select top 1 Cycle from HLShop_Order where Cycle=(select max(Cycle) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + Web_ShopBuy.m_ProductID + ")");
								if (dataTable8 != null && dataTable8.Rows.Count > 0)
								{
									cycle = int.Parse(dataTable8.Rows[0]["Cycle"].ToString());
								}
								dataTable8.Dispose();
							}
							switch (num35)
							{
							case 2:
								if (num49 >= num26)
								{
									shop_Product2.AttimesUpdateTeamPrice(2, Web_ShopBuy.m_ProductID, cycle, num31);
								}
								break;
							case 3:
								if (num50 >= num27)
								{
									shop_Product2.AttimesUpdateTeamPrice(3, Web_ShopBuy.m_ProductID, cycle, num32);
								}
								else
								{
									if (num49 >= num26)
									{
										shop_Product2.AttimesUpdateTeamPrice(3, Web_ShopBuy.m_ProductID, cycle, num31);
									}
								}
								break;
							case 4:
								if (num51 >= num28)
								{
									shop_Product2.AttimesUpdateTeamPrice(4, Web_ShopBuy.m_ProductID, cycle, num33);
								}
								else
								{
									if (num50 >= num27)
									{
										shop_Product2.AttimesUpdateTeamPrice(4, Web_ShopBuy.m_ProductID, cycle, num32);
									}
									else
									{
										if (num49 >= num26)
										{
											shop_Product2.AttimesUpdateTeamPrice(4, Web_ShopBuy.m_ProductID, cycle, num31);
										}
									}
								}
								break;
							case 5:
								if (num52 >= num29)
								{
									shop_Product2.AttimesUpdateTeamPrice(5, Web_ShopBuy.m_ProductID, cycle, num34);
								}
								else
								{
									if (num51 >= num28)
									{
										shop_Product2.AttimesUpdateTeamPrice(5, Web_ShopBuy.m_ProductID, cycle, num33);
									}
									else
									{
										if (num50 >= num27)
										{
											shop_Product2.AttimesUpdateTeamPrice(5, Web_ShopBuy.m_ProductID, cycle, num32);
										}
										else
										{
											if (num49 >= num26)
											{
												shop_Product2.AttimesUpdateTeamPrice(5, Web_ShopBuy.m_ProductID, cycle, num31);
											}
										}
									}
								}
								break;
							}
						}
						if (flag3)
						{
							OrderAction orderAction = new OrderAction(this.conn);
							orderAction.ShopBankPayOrder(base.user.UserID, orderID, num10, "订单预付", 0m, false, "", 0m);
						}
					}
					else
					{
						if (text3 == "4")
						{
							this.UpdateProductField(productnum);
						}
						else
						{
							if (text3 == "5")
							{
								if (!string.IsNullOrEmpty(this.lblNeedPresentExp.Text))
								{
									int num53 = Convert.ToInt32(this.lblNeedPresentExp.Text) * Convert.ToInt32(this.Amount.Text);
									UserExpAction userExpAction = new UserExpAction(this.conn);
									userExpAction.AddUserExpSql(base.user.UserID, (long)num53, 0, "换购商品" + this.ProductName.Text + "消耗的积分", "-");
									userExpAction.AddUserExpSql(this.m_SalerID, (long)num53, 1, "换购商品" + this.ProductName.Text + "获得的积分", "+");
								}
								this.UpdateProductField(productnum);
							}
						}
					}
				}
			}
			if (num15 > 0)
			{
				HoWave.Data.Bll.CouponItem couponItem = new HoWave.Data.Bll.CouponItem();
				HoWave.Data.Model.CouponItem model = couponItem.GetModel(num15);
				if (model != null)
				{
					string smtpserver = this.config["MailSmtpServer"].ToString();
					string mailuser = this.config["MailServerUserName"].ToString();
					string mailpassword = this.config["MailServerPassWord"].ToString();
					string mailFrom = this.config["MailServerFrom"].ToString();
					string text9 = "使用优惠券通知";
					if (!string.IsNullOrEmpty(model.UseOrderID.ToString()))
					{
						DataTable orderByOrderId = this.getOrderByOrderId(model.UseOrderID.ToString());
						if (orderByOrderId.Rows.Count > 0)
						{
							string text10 = orderByOrderId.Rows[0]["OrderFormNum"].ToString();
							string text11 = string.Concat(new string[]
							{
								base.user.UserName,
								"您好：您已经在订单号为",
								text10,
								"，使用了编号为：",
								model.CouponNum,
								"的优惠劵。"
							});
							model.MessageStatus = true;
							string sender2 = orderByOrderId.Rows[0]["SalerName"].ToString();
							MessageBll messageBll = new MessageBll(this.conn);
							bool flag6 = messageBll.AddMessage(sender2, "Users", text9, text11, 0, 0, 1, 0, base.user.UserName, "", 1);
							if (!string.IsNullOrEmpty(base.user.UserEmail))
							{
								string userEmail = base.user.UserEmail;
								model.EmailStatus = true;
								Email email2 = new Email();
								bool flag7 = email2.SendEmail(smtpserver, mailuser, mailpassword, mailFrom, text11, userEmail, text9);
							}
							string text12 = base.user.UserInforRes["MobilePhone"].ToString();
							if (!string.IsNullOrEmpty(text12))
							{
								model.MobileStatus = true;
								MobileMessage mobileMessage = new MobileMessage();
								bool flag8 = mobileMessage.Send(text12, text11, base.user.UserName);
							}
							model.CouponItemID = num15;
							couponItem.Update(model);
						}
					}
				}
			}
		}
		else
		{
			this.WriteErrMsg("", Language.Get("Common/Fail", createOrder.ErrMsg), "");
		}
		Shop_Product shop_Product3 = new Shop_Product();
		if (this.Session["GuiGe"] != null)
		{
			int num47 = shop_Product3.EditFieldProduct(Web_ShopBuy.m_ProductID, this.Session["GuiGe"].ToString(), "ShoppingCarGuige");
		}
		base.ClientRelation(num, "buyorder");
		string msg = Language.Get("Shop/Product/BuySuccess1");
		if (text3 == "1")
		{
			msg = Language.Get("Shop/Product/BuySuccess1");
		}
		else
		{
			if (text3 == "2")
			{
				if (num5 != 1)
				{
					msg = Language.Get("Shop/Product/BuySuccess2c");
				}
				else
				{
					msg = Language.Get("Shop/Product/BuySuccess2a");
				}
			}
			else
			{
				if (text3 == "3")
				{
					msg = Language.Get("Shop/Product/BuySuccess3a");
				}
			}
		}
		base.Response.Expires = 0;
		string comeUrl = "/Member/Index.aspx?mainurl=Shop_BuyOrder.aspx?OrderFormNum=" + str;
		this.WriteSuccessMsg("", msg, comeUrl);
	}
	private void UpdateProductField(int productnum)
	{
		string text = "";
		string text2 = "select BidTimes from HLShop_Product where ProductID=" + Web_ShopBuy.m_ProductID;
		DataTable productByProductID = Shop_Product.instance.GetProductByProductID(Web_ShopBuy.m_ProductID);
		if (productByProductID.Rows.Count > 0)
		{
			if (productByProductID.Columns.Contains("BidTimes"))
			{
				if (productByProductID.Rows[0]["BidTimes"] != DBNull.Value)
				{
					text = ",BidTimes=BidTimes+1";
				}
				else
				{
					text = ",BidTimes=1";
				}
			}
		}
		this.conn.Execute(string.Concat(new object[]
		{
			"update HLShop_Product set BuyTimes=BuyTimes+1,Stocks=Stocks-",
			productnum,
			text,
			" where ProductID=",
			Web_ShopBuy.m_ProductID
		}));
	}
	private DataTable getOrderByOrderId(string orderid)
	{
		DataTable result = null;
		if (!string.IsNullOrEmpty(orderid))
		{
			string sql = "select OrderFormNum,SalerName from HLShop_Order where OrderFormID=" + orderid;
			result = this.conn.GetDataTable(sql);
		}
		return result;
	}
	protected void BindAddress()
	{
		if (this.m_BuyUserID > 0)
		{
			this.my_receive_address.Items.Clear();
			Shop_Address shop_Address = new Shop_Address(this.conn);
			DataTable addressByUserID = shop_Address.GetAddressByUserID(this.m_BuyUserID);
			for (int i = 0; i < addressByUserID.Rows.Count; i++)
			{
				string str = addressByUserID.Rows[i]["Province"].ToString();
				string str2 = addressByUserID.Rows[i]["City"].ToString();
				string str3 = addressByUserID.Rows[i]["CMArea"].ToString();
				string str4 = addressByUserID.Rows[i]["Address"].ToString();
				string str5 = str + str2 + str3 + str4;
				ListItem item = new ListItem(addressByUserID.Rows[i]["UserName"].ToString() + " " + str5, addressByUserID.Rows[i]["AddressID"].ToString());
				this.my_receive_address.Items.Add(item);
			}
			if (this.my_receive_address.Items.Count > 0)
			{
				this.my_receive_address.Items[0].Selected = true;
			}
			if (addressByUserID.Rows.Count > 0)
			{
				this.show_new_address.Attributes.Add("style", "display:block;width:100%;");
				this.manage_address_tr.Attributes.Add("style", "display:block;width:100%;");
			}
			else
			{
				this.show_new_address.Attributes.Add("style", "width:100%;");
				this.manage_address_tr.Attributes.Add("style", "display:none;width:100%;");
			}
			addressByUserID.Dispose();
		}
		else
		{
			this.show_new_address.Attributes.Add("style", "width:100%;");
			this.manage_address_tr.Attributes.Add("style", "display:none;width:100%;");
		}
		this.BindAdressText();
	}
	protected void imgbtnNewAddAddress_Click(object sender, ImageClickEventArgs e)
	{
		this.show_new_address.Attributes.Add("style", "width:100%;");
		if (this.my_receive_address.Items.Count > 0)
		{
			for (int i = 0; i < this.my_receive_address.Items.Count; i++)
			{
				this.my_receive_address.Items[i].Selected = false;
			}
			this.manage_address_tr.Attributes.Add("style", "display:block;width:100%;");
		}
		this.ClearAddress();
	}
	private void ClearAddress()
	{
		this.ContacterName.Text = "";
		this.mobilePhone.Text = "";
		this.homePhone.Text = "";
		this.ddlProvince.SelectedValue = "";
		this.ddlCity.SelectedValue = "";
		this.ddlArea.SelectedValue = "";
		this.Address.Text = "";
		this.Email.Text = "";
		this.zipCode.Text = "";
		this.CmdNewAddress.Text = "添加";
		this.ViewState["AddEdit"] = "Add";
		this.shop_deliver.SelectDeliverItemByProvince(this.hfdeliverPayType.Value, this.ddlProvince.GetSelectValue(new string[0]), this.deliverType);
	}
	protected void my_receive_address_SelectedIndexChanged(object sender, EventArgs e)
	{
		this.show_new_address.Attributes.Add("style", "display:block;width:100%;");
		this.BindAdressText();
	}
	protected void BindAdressText()
	{
		if (this.my_receive_address.SelectedValue != "")
		{
			Shop_Address shop_Address = new Shop_Address(this.conn);
			DataTable addressByID = shop_Address.GetAddressByID(Convert.ToInt32(this.my_receive_address.SelectedValue), this.m_BuyUserID);
			if (addressByID.Rows.Count > 0)
			{
				string text = addressByID.Rows[0]["UserName"].ToString();
				string selectedValue = addressByID.Rows[0]["Province"].ToString();
				string selectedValue2 = addressByID.Rows[0]["City"].ToString();
				string selectedValue3 = "";
				if (addressByID.Columns.Contains("CMArea"))
				{
					if (addressByID.Rows[0]["CMArea"] != DBNull.Value)
					{
						selectedValue3 = addressByID.Rows[0]["CMArea"].ToString();
					}
				}
				string text2 = addressByID.Rows[0]["MobilePhone"].ToString();
				string text3 = addressByID.Rows[0]["ConectPhone"].ToString();
				string text4 = addressByID.Rows[0]["Address"].ToString();
				string text5 = addressByID.Rows[0]["ZipCode"].ToString();
				string text6 = addressByID.Rows[0]["Email"].ToString();
				this.ContacterName.Text = text;
				this.mobilePhone.Text = text2;
				this.homePhone.Text = text3;
				this.ddlProvince.SelectedValue = selectedValue;
				this.BindCity();
				this.BindArea();
				this.ddlCity.SelectedValue = selectedValue2;
				this.GetArea();
				this.ddlArea.SelectedValue = selectedValue3;
				this.Address.Text = text4;
				this.Email.Text = text6;
				this.zipCode.Text = text5;
				this.CmdNewAddress.Text = "修改";
				this.ViewState["AddEdit"] = "Edit";
				this.shop_deliver.SelectDeliverItemByProvince(this.hfdeliverPayType.Value, this.ddlProvince.GetSelectValue(new string[0]), this.deliverType);
			}
		}
		else
		{
			this.ClearAddress();
		}
	}
	private bool CheckInput()
	{
		bool result = true;
		if (string.IsNullOrEmpty(this.mobilePhone.Text) && string.IsNullOrEmpty(this.homePhone.Text))
		{
			MessageBox.Show(this, "手机号码和电话号码至少填写一个！");
			result = false;
		}
		return result;
	}
	protected void CmdNewAddress_Click(object sender, EventArgs e)
	{
		if (this.CheckInput())
		{
			string text = this.ContacterName.Text;
			string text2 = this.mobilePhone.Text;
			string text3 = this.homePhone.Text;
			string text4 = this.Address.Text;
			string text5 = this.Remark.Text;
			string text6 = this.Email.Text;
			string text7 = this.zipCode.Text;
			string selectValue = this.ddlProvince.GetSelectValue(new string[0]);
			string selectValue2 = this.ddlCity.GetSelectValue(new string[0]);
			string cMArea = "";
			if (!string.IsNullOrEmpty(this.ddlArea.GetSelectValue(new string[0])))
			{
				cMArea = this.ddlArea.GetSelectValue(new string[0]);
			}
			if ((this.my_receive_address.SelectedValue == "" && (text == "" || text4 == "")) || selectValue2 == "")
			{
				this.WriteErrMsg("", Language.Get("Shop/Product/BuyAdrres"), "");
			}
			Shop_Address shop_Address = new Shop_Address(this.conn);
			if (this.ViewState["AddEdit"] != null)
			{
				string a = this.ViewState["AddEdit"].ToString().Trim();
				if (a == "Add")
				{
					int num = 10;
					if (!shop_Address.IsMaxCount(int.Parse(Fetch.GetCookies("Howave_UserID")), num))
					{
						shop_Address.InsertAddress(base.user.UserID, text, text4, text7, text3, text2, text6, selectValue, selectValue2, cMArea);
					}
				}
				else
				{
					if (a == "Edit")
					{
						int addressID = 0;
						if (!string.IsNullOrEmpty(this.my_receive_address.SelectedValue))
						{
							addressID = this.my_receive_address.SelectedValue.ToInt32(new int[0]);
						}
						shop_Address.UpdateAddress(base.user.UserID, text, text4, text7, text3, text2, text6, addressID, selectValue, selectValue2, cMArea);
					}
				}
			}
			this.BindAddress();
		}
	}
	protected void PayOnLine(string Md5Key, string OnlinePayType, int OnlinePayTypeID, string DeliverPayType)
	{
	}
	protected void PayLiveLine()
	{
	}
	protected void PayOnGoidCoin()
	{
	}
	public void AddCycle()
	{
		int num = 0;
		int num2 = this.conn.ExecuteCount("select count(*) from HLShop_Order as a left join HLShop_OrderItem as b on a.OrderFormID=b.OrderFormID where a.TradeType=3 and b.ProductID=" + Web_ShopBuy.m_ProductID);
		int num3 = this.conn.ExecuteCount("select count(*) from HLShop_Order as a left join HLShop_OrderItem as b on a.OrderFormID=b.OrderFormID where a.TradeType=3 and a.Teameffect=1 and b.ProductID=" + Web_ShopBuy.m_ProductID);
		DataSet dataSet = this.conn.GetDataSet("select max(Cycle) as Cycle from HLShop_Order as a left join HLShop_OrderItem as b on a.OrderFormID=b.OrderFormID where a.TradeType=3 and b.ProductID=" + Web_ShopBuy.m_ProductID);
		if (dataSet != null && dataSet.Tables[0].Rows.Count > 0)
		{
			if (num2 == num3 && num3 != 0)
			{
				if (this.TeamAfterCycleNum == this.TeamBeforeCycleNum)
				{
					num = int.Parse(dataSet.Tables[0].Rows[0]["Cycle"].ToString()) + 1;
				}
				else
				{
					num = int.Parse(dataSet.Tables[0].Rows[0]["Cycle"].ToString());
				}
			}
			else
			{
				if (this.TeamAfterCycleNum == this.TeamBeforeCycleNum && this.TeamBeforeCycleNum != 0)
				{
					if (this.TotalAfterNumber == 1 && num2 > 1)
					{
						num = int.Parse(dataSet.Tables[0].Rows[0]["Cycle"].ToString()) + 1;
					}
					else
					{
						num = int.Parse(dataSet.Tables[0].Rows[0]["Cycle"].ToString());
					}
				}
				else
				{
					if (dataSet.Tables[0].Rows.Count == 1)
					{
						num = int.Parse(dataSet.Tables[0].Rows[0]["Cycle"].ToString());
					}
					else
					{
						num = int.Parse(dataSet.Tables[0].Rows[0]["Cycle"].ToString()) + 1;
					}
				}
			}
		}
		this.conn.Execute("Update [HLShop_Order] set Cycle=" + num + " where OrderFormID=(select Max(OrderFormID) from HLShop_Order where TradeType=3) and TradeType=3");
	}
	public bool IsExistPayType()
	{
		return this.PayType.Items.Count > 0;
	}
	protected void rblDeliverFashion_SelectedIndexChanged(object sender, EventArgs e)
	{
		string selectedValue = this.rblDeliverFashion.SelectedValue;
		if (!string.IsNullOrEmpty(selectedValue))
		{
			this.shop_deliver.GetDeliverTypeInfoByFashionName(selectedValue, this.deliverType);
			this.shop_deliver.SelectDeliverItemByProvince(this.hfdeliverPayType.Value, this.ddlProvince.GetSelectValue(new string[0]), this.deliverType);
		}
	}
	protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
	{
		string selectValue = this.ddlProvince.GetSelectValue(new string[0]);
		this.shop_deliver.SelectDeliverItemByProvince(this.hfdeliverPayType.Value, selectValue, this.deliverType);
		this.GetCity();
		this.GetArea();
	}
	protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e)
	{
		this.GetArea();
	}
	public void Bind()
	{
		this.BindProvince();
		this.BindCity();
		this.BindArea();
	}
	protected void BindProvince()
	{
		DataTable allProvince = this.m_city.GetAllProvince();
		this.ddlProvince.Items.Clear();
		ListItem item = new ListItem(Language.Get("Common/Choose"), "");
		this.ddlProvince.Items.Add(item);
		this.ddlProvince.DataSource = allProvince;
		this.ddlProvince.DataTextField = "Province";
		this.ddlProvince.DataValueField = "Province";
		this.ddlProvince.DataBind();
		string selectValue = this.ddlProvince.GetSelectValue(new string[0]);
		if (!string.IsNullOrEmpty(selectValue))
		{
			foreach (ListItem listItem in this.ddlProvince.Items)
			{
				if (listItem.Value == selectValue)
				{
					listItem.Selected = true;
					break;
				}
			}
		}
	}
	protected void BindCity()
	{
		if (!string.IsNullOrEmpty(this.ddlProvince.GetSelectValue(new string[0])))
		{
			this.GetCity();
			foreach (ListItem listItem in this.ddlCity.Items)
			{
				if (listItem.Value == this.ddlCity.GetSelectValue(new string[0]))
				{
					listItem.Selected = true;
					break;
				}
			}
		}
		else
		{
			this.ddlCity.Items.Clear();
			this.ddlCity.Items.Add(new ListItem(Language.Get("Common/Choose"), ""));
		}
	}
	protected void GetCity()
	{
		this.ddlCity.Items.Clear();
		this.ddlCity.Items.Add(new ListItem(Language.Get("Common/Choose"), ""));
		if (!string.IsNullOrEmpty(this.ddlProvince.GetSelectValue(new string[0])))
		{
			DataTable city = this.m_city.GetCity(this.ddlProvince.GetSelectValue(new string[0]));
			if (city != null && city.Rows.Count > 0)
			{
				this.ddlCity.DataSource = city;
				this.ddlCity.DataTextField = "city";
				this.ddlCity.DataValueField = "city";
				this.ddlCity.DataBind();
			}
		}
	}
	protected void GetArea()
	{
		this.ddlArea.Items.Clear();
		this.ddlArea.Items.Insert(0, new ListItem(Language.Get("Common/Choose"), ""));
		if (!string.IsNullOrEmpty(this.ddlCity.GetSelectValue(new string[0])))
		{
			DataTable allAreaByCity = this.m_city.GetAllAreaByCity(this.ddlCity.GetSelectValue(new string[0]));
			if (allAreaByCity != null && allAreaByCity.Rows.Count > 0)
			{
				this.ddlArea.DataSource = allAreaByCity;
				this.ddlArea.DataTextField = "area";
				this.ddlArea.DataValueField = "area";
				this.ddlArea.DataBind();
			}
		}
	}
	protected void BindArea()
	{
		if (!string.IsNullOrEmpty(this.ddlCity.GetSelectValue(new string[0])))
		{
			this.GetArea();
			foreach (ListItem listItem in this.ddlArea.Items)
			{
				if (listItem.Value.Equals(this.ddlArea.GetSelectValue(new string[0])))
				{
					listItem.Selected = true;
					break;
				}
			}
		}
		else
		{
			this.ddlArea.Items.Clear();
			this.ddlArea.Items.Add(new ListItem(Language.Get("Common/Choose"), ""));
		}
	}
}
